home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / elecmail / cs_mac07.zip / ACTION.MAC next >
Text File  |  1993-03-28  |  12KB  |  311 lines

  1.  
  2.  ┌────────────────────────────────┐
  3.  │  Chuck Seyboldt's COMMO Macro  │   CS-MAC07:ACTION.MAC
  4.  └────────────────────────────────┘
  5.  
  6.     ┌──────────────────────────────────┐
  7. ┌───┤  COMMO "ACTION processor" macro  ├───
  8.     └──────────────────────────────────┘
  9.   *
  10.   *  ACTION.MAC reads simple ASCII files and sends commands and
  11.   *  strings to the BBS based on the ACTION file.  Setup for PCBoards.
  12.   *
  13.   *  You may make an ACTION file manually with a text editor.
  14.   *  An ACTION file generator is included later as the :alf macro command.
  15.   *  Located in the COMMO home dir, the ACTION file has this sort of format:
  16.   *
  17. *┌───────────────────────────────  action.nl  ─┐
  18. *│ u                                           │ < "U" for upload
  19. *│ filename.ul                                 │ < Name the file to u/l
  20. *│ A line of file desription.  Up to 45 chars  │ < decription
  21. *│ in length.  Multiple line descriptions are  │
  22. *│ supported if your BBS host allows them.     │
  23. *│ --                                          │ < "--" to end ACTION item
  24. *│ d                                           │ < "D" for download
  25. *│ file1.dl                                    │ < batch downloads allowed
  26. *│ another.zip                                 │
  27. *│ filemore.lhz                                │
  28. *│ --                                          │ < "--" is important
  29. *│ u                                           │
  30. *│ another.zip                                 │
  31. *│ /Private to the sysop.  Thanks for the fish │
  32. *│ --                                          │ < Esp. at the very end.
  33. *└─────────────────────────────────────────────┘
  34.   *
  35.  {:action}
  36.          {sete-P0 esc}
  37.          {ifex %_hom%action.%abbr,,esc}
  38.          {rope %_hom%action.%abbr,act-end}              <- START here
  39.  {:reread}
  40.          {pops-c}
  41.          {setl 60,,10,|}
  42.          {read cmd}                          ;read line of ACTION file
  43.          {comp cmd,--}  {ifco reread}        ;branch to appropriate ACTION
  44.          {comp cmd,a}   {ifco asciup}
  45.          {comp cmd,j}   {ifco joincn}
  46.          {comp cmd,d}   {ifco dlfile}
  47.          {comp cmd,u}   {ifco ulfile}        ;if no match, end ACTION
  48.  
  49.  {:act-end}                                  ;When at end of ACTION list
  50.          {exec-n echo ^j*-*-* %_dat %_tim >> %savedir\used-act.%abbr}
  51.          {exec-n type %_hom%action.%abbr  >> %savedir\used-act.%abbr}
  52.          {exec-n del  %_hom%action.%abbr}
  53.          {setv line}  {setv fname}  {setv cmd}
  54.  {:esc}  {macl logon.mac,noact}                         <-  END here
  55.  
  56.  ┌──────────────────────────────┐
  57.  │  Download processor section  │
  58.  └──────────────────────────────┘
  59.  
  60.  {:dlfile}
  61.          {send %cmd%|}                  ;Setup is for Zmodem BATCH downloads
  62.          {golo skip,not avai}           ;If host doesn't allow d/l, skip it
  63.  {:next-d}{read fname}                  ;Read one complete line into %fname%
  64.          {inst fname,--} {ifco do-dl}
  65.          {ifex %dldir\%fname,next-d}    ;Don't try to d/l files that exist
  66.          {send %fname%~~~|}             ;Send filename to BBS
  67.          {goto next-d}                  ;Repeat read til dl-list is all read
  68.  {:do-dl}{send |~~|}                    ;Start download
  69.          {call dlfile-%prot}            ;call file download subroutine
  70.          {look %bbs_pmt}
  71.          {goto reread}                  ;end of "D" ACTION processor
  72.  
  73.  ┌────────────────────────────┐
  74.  │  Upload processor section  │
  75.  └────────────────────────────┘
  76.  
  77.  {:ulfile}
  78.          {read fname}                   ;Upload ACTION starts
  79.          {ifex %uldir\%fname,,skip}     ;Make sure file exists on your disk
  80.          {send u %fname% %prot|}        ;Tell host to get ready for u/l
  81.          {golo skip,Insufficient}       ; disk space for complete upload!
  82.          {golo skip,not avai}           ;If host doesn't allow u/l, or
  83.          {golo skip,y exists}           ;If host says file already exists,
  84.          {golo skip,plicates}           ;  skip this u/l action item.
  85.          {look ximum)}                  ;Host is ready for description.
  86.  {:desc} {read line}
  87.          {comp line,--}                 ;Check for end of u/l action
  88.          {ifco ul_ok}
  89.          {send ~%line%|}                ;Send description line
  90.          {goto desc}                    ;and look for more description
  91.  {:ul_ok}{send ~|}
  92.          {call ulfile-%prot}            ;call file transfer subroutine
  93.          {setl 60,,30,|}                ;Allow time for file validation
  94.          {look %bbs_pmt}
  95.          {goto reread}                  ;end of "U" ACTION processor
  96.  
  97.  ┌────────────────────────────┐
  98.  │  Skip to next action item  │
  99.  └────────────────────────────┘
  100.  
  101.  {:skip} {read line}                    ;SKIP section jumps to next
  102.          {comp line,--}                 ;  action item by reading to
  103.          {ifco ,skip}                   ;  the next "--" string.
  104.          {send |}
  105.          {setl 50,,3,|}
  106.          {look %bbs_pmt}
  107.          {goto reread}                  ;alternate end of "U" processor
  108.  
  109.   *  ASCII uploads take a special form.  Here is an example message.
  110.   *  You may need to structure ASCII upload messages differently.
  111.   *
  112. *┌──────────────────────────────────  hijack ──┐
  113. *│ jack kilday                                 │ < Message Recipient
  114. *│ Thanks for the Fish                         │ < Message Subject
  115. *│ n                                           │ < Public/Private msg flag
  116. *│ u                                           │ < Use ASCII u/l, not editor
  117. *│ Hi Jack,                                    │
  118. *│                                             │
  119. *│     Just stopping in with a test of a COMMO │
  120. *│ ACTION macro processor.  I also wanted to   │
  121. *│ give you a big THANK YOU for all the fish.  │
  122. *│ They were delicious.                        │
  123. *│                                             │
  124. *│                                   Chuck·S   │
  125. *└─────────────────────────────────────────────┘
  126.   *
  127.  {:asciup}
  128.          {read fname}                   ;ASCII upload to PCBoard system
  129.          {ifex %dldir\%fname%,,reread}
  130.          {parm ,,,,2}                   ;Set character pacing
  131.          {send e|}                      ;Send "E" to start message entry
  132.          {asci %dldir\%fname%,}         ;Send the structured message
  133.          {parm ,,,,0}                   ;No character pacing
  134.          {send ~~|~~~sn|}               ;the PCBoard "save" command
  135.          {look %bbs_pmt}
  136.          {goto reread}                  ;end of "A" processor
  137.  
  138.  ┌───────────────────────────┐
  139.  │  Join conference section  │
  140.  └───────────────────────────┘
  141.  
  142.  {:joincn}
  143.          {read fname}                   ;Join PCBoard Conference
  144.          {send j %fname|}
  145.          {push}
  146.          {golo n|,)=yes?}               ;Skip mail scan
  147.          {golo |,invalid}               ;If you choose invalid conf
  148.          {golo n|,(H)elp}               ;If you chose invalid conf
  149.          {golo 0|,none?}                ;To conf 0 on invalid conf
  150.          {look %bbs_pmt}  {pops}
  151.          {goto reread}                  ;end of "J" processor
  152.  
  153.     ┌───────────────────────────────────┐
  154. └───┤  End Of "ACTION processor" macro  ├───────
  155.     └───────────────────────────────────┘
  156.  
  157.     ┌─────────────────────────────┐
  158. ┌───┤  "ACTION generator"  macro  ├───
  159.     └─────────────────────────────┘
  160.   *
  161.   *  This macro uses PKUNZIP to automatically insert the file
  162.   *  description from a DESC.SDI or a FILE_ID.DIZ that might be
  163.   *  found in a ZIP file.
  164.   *
  165.   *  This macro isn't commented.  It is pretty easy to follow.
  166.  
  167.  {:alf}  {sete-p0 icmnd}
  168.          {inpu abbr,Make ^(ACTION^) file:  What BBS?}   <- START Here
  169.          {comp abbr}    {ifco opena}
  170.          {subs abbr,1,2,%abbr}
  171.  {:opena}{wope-a %_hom%action.%abbr}
  172.  
  173.  {:icmnd}{setv cmd} {setv fname} {setv line}
  174.          {inpu cmd,^(U^)pload, ^(D^)ownload, ^(A^)scii Upload, ^(J^)oin Conf?}
  175.          {comp cmd,u}   {ifco makeul}
  176.          {comp cmd,d}   {ifco makedl}
  177.          {comp cmd,a}   {ifco makeau}
  178.          {comp cmd,j}   {ifco makejn}
  179.          {comp cmd}     {ifco ,icmnd}
  180.          {wclo}         {edit %_hom%action.%abbr}
  181.          {rope %_hom%action.%abbr}
  182.          {read line}    {rclo}                  ;check for empty
  183.          {comp line}    {ifco ,no_del}          ;ACTION file
  184.          {exec-n del %_hom%action.%abbr}        ;delete if empty
  185.  {:no_del}
  186.          {setv cmd}     {setv fname} {setv line}
  187.          {comp mt}      {ifco ,menu}
  188.          {macl %_mac}                                   <- END Here
  189.  {:menu} {macl cs-mac.mac,clect}                        <-  or here
  190.  
  191.  {:makejn}
  192.          {inpu fname,Name or Number of Conference to Join}
  193.          {comp fname}   {ifco icmnd}
  194.          {writ j}
  195.          {writ %fname}
  196.          {writ --}      {goto icmnd}
  197.  
  198.  {:makeau}
  199.          {inpu fname,Name the ASCII Upload}
  200.          {comp fname}   {ifco icmnd}
  201.          {ifex %dldir\%fname,,makeau}
  202.          {writ a}
  203.          {writ %fname}
  204.          {writ --}      {goto icmnd}
  205.  
  206.  {:makedl}
  207.          {setv fname}   {setv count,1}
  208.          {inpu fname,Name a File that you want to DownLoad}
  209.          {comp fname}   {ifco icmnd}
  210.          {writ d}
  211.  {:dlmore}
  212.          {writ %fname}
  213.          {incr count}   {setv fname}
  214.          {inpu fname,File #%count% to Download?}
  215.          {comp fname}   {ifco ,dlmore}
  216.          {writ --}      {goto icmnd}
  217.  
  218.  {:makeul}
  219.          {inpu fname,Name the file to upload}
  220.          {comp fname}   {ifco icmnd}
  221.          {ifex %dldir\%fname,descul,makeul}
  222.  {:descul}
  223.          {exec-d %pk_un -v %dldir\%fname desc.sdi file_id.diz}
  224.          {ifer 1,,diz_dsc}
  225.          {setv count,1}
  226.          {setv line}
  227.          {inpu line,One line description of %fname% Required}
  228.          {comp line}    {ifco icmnd}
  229.          {writ u}       {write %fname}
  230.          {writ %line}   {incr count}
  231.  {:mdesc}{setv line}    {inpu line,Line %count% of %fname% description}
  232.          {comp line}    {ifco endul}
  233.          {writ %line}   {incr count}
  234.          {goto mdesc}
  235.  {:endul}{writ --}      {goto icmnd}
  236.  
  237.  {:diz_dsc}
  238.          {writ u}       {write %fname}
  239.          {setv file,file_id.diz}
  240.  {:add_dsc}
  241.          {exec-d %pk_un -v %uldir\%fname %file}
  242.          {ifer 1,chk_sdi}
  243.          {exec-n %pk_un -o %uldir\%fname %ramdr\ %file}
  244.          {rope %ramdr\%file,endul}
  245.  {:diz_lp}
  246.          {read line}
  247.          {writ %line}
  248.          {goto diz_lp}
  249.  {:chk_sdi}
  250.          {setv file,desc.sdi}
  251.          {goto add_dsc}
  252.  
  253.     ┌───────────────────────────────────┐
  254. └───┤  End Of "ACTION generator" macro  ├───────
  255.     └───────────────────────────────────┘
  256.  
  257.  ┌──────────────────────────────────────┐
  258.  │  File Transfer protocol subroutines  │
  259.  └──────────────────────────────────────┘
  260.   *
  261.   *  This arrangement provides a method to easily expand the file
  262.   *  transfer protocols that one might use.
  263.  
  264.  ┌──────────┐
  265.  │  Zmodem  │
  266.  └──────────┘
  267.  {:ulfile-z}
  268.  {:ulfile-}                             ;default protocol is "Z"
  269.          {look ^xB01}                   ;Zmodem .REP Upload
  270.          {exec-n %z_prog port %_por ha bo sz -m %uldir\%fname}
  271.          {retu}
  272.  
  273.  {:dlfile-z}
  274.  {:dlfile-}                             ;default protocol is "Z"
  275.          {push}
  276.          {golo reread,%bbs_pmt}         ;if no filenames matched
  277.          {golo n|,ed? [}                ;Wildcat logoff after transfer
  278.          {golo z|,] ? [}                ;Wildcat protocol select
  279.          {look ^xB00}
  280.          {pops}
  281.          {exec-n %z_prog port %_por ha bo rz -mr %dldir}
  282.          {golo reread,] ? [}            ;At Wildcat File Menu
  283.          {retu}
  284.  
  285.  ┌──────────┐
  286.  │  Ymodem  │
  287.  └──────────┘
  288.  {:ulfile-y}                            ;Ymodem File Upload
  289.          {paus 10}
  290.          {symo-k %uldir\%fname}
  291.          {retu}
  292.  
  293.  {:dlfile-y}                            ;Ymodem File Download
  294.          {paus 10}
  295.          {rymo-y %dldir}                ;overwrite exiting files
  296.          {retu}
  297.  
  298.  ┌──────────┐
  299.  │  Xmodem  │
  300.  └──────────┘
  301.  {:ulfile-x}                            ;Xmodem File Upload
  302.          {paus 10}
  303.          {sxmo-y %uldir\%fname}
  304.          {retu}
  305.  
  306.  {:dlfile-x}                            ;Xmodem File Download
  307.          {paus 10}
  308.          {send g}
  309.          {rxmo-y %dldir\%fname}
  310.          {retu}
  311.